package com.dc.zuul.responsibility;

import com.dc.zuul.responsibility.factory.FactoryHandler;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author: KEYD
 * @Date: 2020/1/19 12:24
 * @Desc: 责任链的调用方
 */

@Component
public class ResponsibilityClient {

    /**
     * 责任链调用
     */
    public void responsibility() {
        List<GatewayHandler> addHandlers = FactoryHandler.getHandler();
        for (GatewayHandler gatewayHandler : addHandlers) {
            boolean service = gatewayHandler.service();
            if (!service) {
                return;
            }
        }
    }
}
